package lc.二分;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/10/15
 */
public class 剑指Offer53II中缺失的数字 {

    public int missingNumber(int[] nums) {

        int left=0, right=nums.length-1;
        while (left <= right) {
            int mid=left+(right-left)/2;
            if (nums[mid] == mid) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
        return left;
    }

}
